﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chap4Demo
{
    /// <summary>
    /// 大象
    /// </summary>
    internal class Elephant
    {
        public string Name;
        public int EarSize;

        public void WhoAmI()
        {
            Console.WriteLine($"My name is {Name}.");
            Console.WriteLine($"My ears are {EarSize} inches tall");
        }

        public void HearMeaasge(string message, Elephant whoSaidIt)
        {
            Console.WriteLine($"{Name} heard a message");
            Console.WriteLine($"{whoSaidIt.Name} said this:{message}");
        }

        /// <summary>
        /// lucinda.SpeekTo(lloyd, "Hi Lloyd!!!");
        /// lloyd heard a message
        /// lucinda said this:Hi Lloyd!!!
        /// </summary>
        /// <param name="whoToTalkTo"></param>
        /// <param name="message"></param>
        public void SpeekTo(Elephant whoToTalkTo, string message)
        {
            whoToTalkTo.HearMeaasge(message, this);
        }
    }
}
